package com.example.anpapi.entity.po.novelmodel.ChapterVersion;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

@TableName("chapter_versions")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ChapterVersion implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 版本ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 章节ID
     */
    @TableField("chapter_id")
    private Long chapterId;

    /**
     * 版本号
     */
    @TableField("version_number")
    private Integer versionNumber;

    /**
     * 章节内容
     */
    @TableField("content")
    private String content;

    /**
     * Quill Delta格式内容
     */
    @TableField(value = "content_delta", typeHandler = JacksonTypeHandler.class)
    private Object contentDelta;

    /**
     * 字数
     */
    @TableField("word_count")
    private Integer wordCount;

    /**
     * 变更描述
     */
    @TableField("change_description")
    private String changeDescription;

    /**
     * 创建人（用户ID）
     */
    @TableField("created_by")
    private Long createdBy;

    /**
     * 创建时间
     */
    @TableField(value = "created_time", fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdTime;

}

